﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Kinect;
using KSASupport.Calibration;

namespace KSASupport
{

    /// <summary>
    /// Instantiates Managers and controls flow of depth data, images, blob detection, etc.
    /// </summary>
    public class KSAEngine
    {

        private List<DepthManager> depthManagers;
        /// <summary>
        /// List of depthmanagers registered with this engine
        /// </summary>
        public List<DepthManager> DepthManagers
        {
            get { return depthManagers; }
            set { depthManagers = value; }
        }

        /// <summary>
        /// Gets the number of Kinect devices seen by this system
        /// </summary>
        /// <returns>the number of kinects found</returns>
        static public int GetNumberOfKinects()
        {
            return KinectSensor.KinectSensors.Count();
        }

        /// <summary>
        /// Instantiates a new engine
        /// </summary>
        public KSAEngine()
        {
            depthManagers = new List<DepthManager>();
        }
        

        /// <summary>
        /// Simple initialization which makes some assumptions(near mode, 320x240, one kinect)
        /// </summary>
        public void InitializeSingleKinect()
        {          
            depthManagers.Add(new DepthManager());  
                     
        }
        /// <summary>
        /// Add an addititional Kinect to the existing list registered with the depthmanager
        /// </summary>
        /// <param name="KinectIndex"></param>
        public void AddKinect(int KinectIndex)
        {
            DepthManager depthManager = new DepthManager(KinectIndex);
            depthManager.Initialize();
            depthManagers.Add(depthManager);
        }
    }
}
